package jdk5.concurrent.tiger;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

public class Account{
        private String name;
        private AtomicBoolean freezen;
        private AtomicInteger balance;

        public Account(String name, int balance){
                   this.name = name;
                   this.balance = new AtomicInteger(balance);
                   freezen = new AtomicBoolean(false);
        }

       public void freeze(){
                   freezen.set(true);
      }

      public void unfreeze(){
                 freezen.set(false);
      }

      public void deposit(int  amt){
               balance.getAndAdd(amt);
      }

      public void withdraw(int amt){
               balance.getAndAdd(-amt);
      }
}